package com.qujia.web.controller.task;

import com.qujia.station.service.InventoryReportDailyService;
import com.qujia.station.service.InventoryReportMonthlyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
@Slf4j
public class NonOilTask {

    @Autowired
    private InventoryReportDailyService inventoryReportDailyService;

    @Autowired
    private InventoryReportMonthlyService inventoryReportMonthlyService;

    @Scheduled(cron="0 0 1 * * ?")//每天凌晨 1 点执行定时任务
    public void inventoryReportDailyStatistics(){
        inventoryReportDailyService.inventoryReportDailyStatistics();
    }

    @Scheduled(cron="0 30 1 1 * ?")//每月1号午夜凌晨 1 点 30分执行定时任务
    public void inventoryReportMonthlyStatistics(){
        inventoryReportMonthlyService.inventoryReportMonthlyStatistics();
    }
}
